function Page(totalLines){
	
	if (arguments.length==0){
	 totalLines = 1;
	}
	
	this.totalLines = totalLines;
	this.linesPerPage = 1;
	this.pages = this.calculatePages();	
	
	this.currentPage = 1;
	this.pageBegin = this.getPageBegin();
	this.pageEnd = this.getPageEnd();
	
	return this;
}//Page

//---------------------------------------------------------------------------------------

Page.prototype.calculatePages = function(){
	
	if (this.totalLines==0){
		return 1;
	}//if
	
	if (this.totalLines%this.linesPerPage==0){
		return this.totalLines/this.linesPerPage;
	}//if
	
	return parseInt(this.totalLines/this.linesPerPage) + 1;	
	
}//calculatePages

//---------------------------------------------------------------------------------------

Page.prototype.getPages = function(){
	return this.pages;
}//getPages

//---------------------------------------------------------------------------------------

Page.prototype.setTotalLines = function(totalLines){
	this.totalLines = totalLines;
	this.pages  = this.calculatePages();
	
}//setTotalLines

//---------------------------------------------------------------------------------------

Page.prototype.getTotalLines = function(){
	return this.totalLines;
}//getTotalLines

//---------------------------------------------------------------------------------------

Page.prototype.setLinesPerPage = function(linesPerPage){
	
	this.linesPerPage = linesPerPage;
	this.pages  = this.calculatePages();
		
}//setLinesPerPage

//---------------------------------------------------------------------------------------

Page.prototype.getLinesPerPage = function(){
	return this.linesPerPage;
}//getLinesPerPage

//---------------------------------------------------------------------------------------

Page.prototype.setCurrentPage = function(currentPage){
	this.currentPage = currentPage;
}//setCurrentPage

//---------------------------------------------------------------------------------------

Page.prototype.getCurrentPage = function(){
	return this.currentPage;
}//getCurrentPage

//---------------------------------------------------------------------------------------

Page.prototype.getPageBegin = function(){
	return ((this.currentPage-1) * this.linesPerPage) + 1;
}//getPageBegin

//---------------------------------------------------------------------------------------

Page.prototype.getPageEnd = function(){

	if (this.currentPage * this.linesPerPage >= this.totalLines){
		return this.totalLines;
	}//if
	
	return this.currentPage * this.linesPerPage;
	
}//getPageEnd